﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WAF.DAO;
using WAF.EntityFramework;

namespace EntityTools.Model
{
    /// <summary>
    /// 数据库信息
    /// </summary>
    public partial class DbInfo : Entity
    {
        /// <summary>
        /// 数据库中文名称
        /// </summary>
        [EntityField(1, isDisplay: true, label: "数据库中文名称")]
        public string Name { get; set; }

        /// <summary>
        /// 数据库类型
        /// </summary>
        [EntityField(2, isDisplay: true, label: "数据库类型")]
        public string Type { get; set; }

        /// <summary>
        /// 服务器地址
        /// </summary>
        [EntityField(3, isDisplay: true, label: "服务器地址")]
        public string Server { get; set; }

        /// <summary>
        /// 数据库名
        /// </summary>
        [EntityField(4, isDisplay: true, label: "数据库名")]
        public string DbName { get; set; }

        /// <summary>
        /// 登录账号
        /// </summary>
        [EntityField(5, isDisplay: true, label: "登录账号")]
        public string Account { get; set; }

        /// <summary>
        /// 登录密码
        /// </summary>
        [EntityField(6, isDisplay: true, label: "登录密码")]
        public string Password { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [EntityField(7, isDisplay: true, label: "备注")]
        public string Remark { get; set; }
    }

    /// <summary>
    /// 数据库表信息
    /// </summary>
    public partial class TableInfo : Entity
    {
        /// <summary>
        /// 所属数据库
        /// </summary>
        [EntityField(1, isDisplay: true, dbType:System.Data.DbType.Int64, label: "所属数据库")]
        public long DatabaseID { get; set; }

        /// <summary>
        /// 表名
        /// </summary>
        [EntityField(2, isDisplay: true, label: "表名")]
        public string TableName { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [EntityField(3, isDisplay: true, label: "备注")]
        public string Remark { get; set; }
    }

    /// <summary>
    /// 字段信息
    /// </summary>
    public partial class FieldInfo : Entity
    {
        /// <summary>
        /// 所属表
        /// </summary>
        [EntityField(1, isDisplay: true, label: "所属表")]
        public long TableID { get; set; }

        /// <summary>
        /// 字段名
        /// </summary>
        [EntityField(2, isDisplay: true, label: "字段名")]
        public string FieldName { get; set; }

        /// <summary>
        /// 字段类型
        /// </summary>
        [EntityField(3, isDisplay: true, label: "字段类型")]
        public string FieldType { get; set; }

        /// <summary>
        /// 字段次序
        /// </summary>
        [EntityField(4, isDisplay: true, label: "字段次序")]
        public int Ordinal { get; set; }

        /// <summary>
        /// 是否为主键
        /// </summary>
        [EntityField(5, isDisplay: true, label: "是否为主键", dbType: System.Data.DbType.Boolean)]
        public bool IsPrimaryKey { get; set; }

        /// <summary>
        /// 是否为外键
        /// </summary>
        [EntityField(6, isDisplay: true, label: "是否为外键", dbType: System.Data.DbType.Boolean)]
        public bool IsForeignKey { get; set; }

        /// <summary>
        /// 是否可为空
        /// </summary>
        [EntityField(7, isDisplay: true, label: "是否可为空", dbType: System.Data.DbType.Boolean)]
        public bool IsNullable { get; set; }

        /// <summary>
        /// 是否是唯一
        /// </summary>
        [EntityField(8, isDisplay: true, label: "是否是唯一", dbType: System.Data.DbType.Boolean)]
        public bool IsUnique { get; set; }

        /// <summary>
        /// 是否显示该字段
        /// </summary>
        [EntityField(9, isDisplay: true, label: "是否显示该字段", dbType: System.Data.DbType.Boolean)]
        public bool IsDisplay { get; set; }

        /// <summary>
        /// 用于显示的字段标签
        /// </summary>
        [EntityField(10, isDisplay: true, label: "用于显示的字段标签")]
        public string Label { get; set; }

        /// <summary>
        /// 关联表的名称
        /// </summary>
        [EntityField(11, isDisplay: true, label: "关联表的名称")]
        public string RefTable { get; set; }

        /// <summary>
        /// 关联表的标签字段
        /// </summary>
        [EntityField(12, isDisplay: true, label: "关联表的标签字段")]
        public string RefLableField { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [EntityField(13, isDisplay: true, label: "备注")]
        public string Remark { get; set; }
    }
    
}
